package controller.states;

import controller.Controller;
import controller.Controller.StateType;
import controller.IState;

/*
 * 
 * VictoryState class
 * 
 * State used when a level must be loaded.
 * When the user presses the Enter key the game enters the GamePlayState.
 * 
 */

public class VictoryState implements IState {

	Controller controller;
	private StateType state;

	private static final int ENTER = 10;

	/**
	 * VictoryState
	 * 
	 * creates the VictoryState based upon the passed in controller
	 * 
	 * @param c
	 */
	public VictoryState(Controller c) {
		controller = c;
		state = StateType.VICTORY;
		controller.setLoadingLevel(true);
	}

	/* (non-Javadoc)
	 * @see controller.IState#getState()
	 */
	@Override
	public StateType getState() {
		return state;
	}

	/* (non-Javadoc)
	 * @see controller.IState#handleKeyPressed(int)
	 */
	@Override
	public void handleKeyPressed(int keyCode) {
		return;
	}

	/* (non-Javadoc)
	 * @see controller.IState#handleKeyReleased(int)
	 */
	@Override
	public void handleKeyReleased(int keyCode) {
		switch (keyCode) {
		case ENTER: {
			controller.setLoadingLevel(false);
			controller.setState(new GameplayState(controller));
			break;
		}

		default:
			break;
		}
	}

}
